def my_middleware(get_response):
    print('被调用init')
    def middleware(request):
        print('before_request被调用')
        response =get_response(request)
        print('after_request被调用')
        return response
    return middleware

def my_middleware2(get_response):
    print('被调用init2')
    def middleware(request):
        print('before_request2被调用')
        response =get_response(request)
        print('after_request2被调用')
        return response
    return middleware